

<template>
<el-dialog title="订单信息" center :visible.sync='visible'
           :close-on-click-modal="false" @close="close">
<el-form :model="dataForm" label-width="80px">
  <el-form-item label="订单编号">
    <el-input disabled v-model="dataForm.orderCode"></el-input>
  </el-form-item>
  <el-form-item label="详细地址">
    <el-input disabled v-model="dataForm.fullAddress"></el-input>
  </el-form-item>
  <el-form-item label="最晚发货时间">
    <el-input disabled v-model="dataForm.sendTime"></el-input>
  </el-form-item>
  <el-form-item label="订单状态">
    <el-input disabled v-model="dataForm.orderStatus"></el-input>
  </el-form-item>
  <el-form-item label="订单总价">
    <el-input disabled v-model="dataForm.orderTotalPrice"></el-input>
  </el-form-item>
  <el-form-item label="收货人">
    <el-input disabled v-model="dataForm.receiver"></el-input>
  </el-form-item>
  <el-form-item label="收货人电话">
    <el-input disabled v-model="dataForm.receiverPhone"></el-input>
  </el-form-item>
  <el-form-item label="备注">
    <el-input disabled v-model="dataForm.remark"></el-input>
  </el-form-item>
  <el-table v-if="dataForm.skuNumber.length >= 0" :data="dataForm.skuNumber">
    <el-table-column prop="orderInfo.spuName" label="商品名称"  align="center">
      <template slot-scope="scope">
        {{ scope.row.orderInfo.spuName }}
      </template>
    </el-table-column>
    <el-table-column prop="num" label="商品数量" align="center">
      <template slot-scope="scope">
        {{ scope.row.num }}
      </template>
    </el-table-column>
    <el-table-column prop="orderInfo.skuSpecs" label="商品规格"  align="center">
      <template slot-scope="scope">
        {{ scope.row.orderInfo.skuSpecs }}
      </template>
    </el-table-column>
  </el-table>
</el-form>
  <span slot="footer" class="dialog-footer">
      <el-button @click="close">确定</el-button>
  </span>
</el-dialog>
</template>
<script>
export default {
  data() {
    return {
      visible: false,
      dataForm: {
        sendTime:'',
        orderCode: '',
        address:"",
        deliveryTime:"",
        orderStatus:0,
        orderTotalPrice:"",
        receiver:"",
        receiverPhone:"",
        remark:"",
        skuNumber:[],
  /*  {
      num:0,
        orderInfo:{
      spuName:'',
        skuSpecs:''
    }*/
        fullAddress:""
      }
    }
  },
  methods: {
    init(orderCode) {

      this.visible = true
      this.dataForm.orderCode = orderCode
      console.log(orderCode)
      if (this.dataForm.orderCode != null) {
        console.log("ssss")
        this.$http({
          url: this.$http.adornUrl(`/MerchantOrder/getInfo/${this.dataForm.orderCode}`),
          method: 'get'
        }).then(({data})=>{
          this.dataForm.skuNumber = data.infoOrder.skuNums;
          // this.dataForm.skuNumber = data.infoOrder.skuNums.map(item => ({
          //   num: item.num,
          //   orderInfo: {
          //     spuName: item.orderInfo.spuName,
          //     skuSpecs: item.orderInfo.skuSpecs
          //   }
          // }));
          // 其他属性赋值保持不变
          this.dataForm.address = data.infoOrder.address;
          this.dataForm.fullAddress = data.infoOrder.fullAddress;
          this.dataForm.orderStatus = data.infoOrder.orderStatus;
          this.dataForm.orderTotalPrice = data.infoOrder.orderTotalPrice;
          this.dataForm.receiver = data.infoOrder.receiver;
          this.dataForm.receiverPhone = data.infoOrder.receiverPhone;
          this.dataForm.remark = data.infoOrder.remark;
          this.dataForm.sendTime = data.infoOrder.sendTime;
          console.log('data',data)
          console.log('dataForm',this.dataForm)
        })
      }
    },
    close() {
      console.log("close")
        this.visible = false
    }
  }
}

</script>
<style>

</style>
